Skip to content

Fix create data structure from ome.tif#1104

Merged
ElpadoCan merged 4 commits into
mainfrom
fix_datastruct_ome_tiff
May 28, 2026
Merged

Fix create data structure from ome.tif#1104
ElpadoCan merged 4 commits into
mainfrom
fix_datastruct_ome_tiff

Conversation

@ElpadoCan
Copy link
Copy Markdown
Collaborator

This PR implements a fix for creating the data structure from .ome.tif files.

More specifically:

  • The '.ome.tif' must be allowed in the filename at line
    if not acdc_regex.is_alphanumeric_filename(file):
    --> modified function with kwarg allowed --> `allowed = ( '.ome.tif',)
  • Ignore if self.omexml_string at line
    self.omexml_string = self.read_omexml_string()

@ElpadoCan ElpadoCan marked this pull request as ready for review May 22, 2026 12:49
@Teranis Teranis requested a review from Copilot May 27, 2026 16:00
@Teranis
Copy link
Copy Markdown
Member

Teranis commented May 27, 2026

Hi, I didnt check the functionality but I assume you tried if it worked and also if it breaks old implementation. I will approve, but wait until copilot is done and see if it finds anything

@Teranis Teranis self-requested a review May 27, 2026 16:01
Copy link
Copy Markdown
Member

@Teranis Teranis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! 🚀

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes issues encountered when creating a data structure from .ome.tif files by (1) relaxing filename validation to permit the .ome.tif suffix and (2) handling cases where OME-XML metadata is missing in TIFF tags.

Changes:

  • Allow .ome.tif filenames in dataStruct.checkFileNames() by passing an allowed suffix to filename validation.
  • Extend acdc_regex.is_alphanumeric_filename() with an allowed suffix parameter to support multi-dot extensions.
  • Guard OME-XML parsing in load.OMEXML.parse_metadata() when no OME metadata is present.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
cellacdc/load.py Avoids parsing OME-XML when tif.ome_metadata is missing.
cellacdc/dataStruct.py Permits .ome.tif filenames during raw data structure creation.
cellacdc/acdc_regex.py Adds support for allowed multi-dot suffixes in filename validation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cellacdc/acdc_regex.py
Comment thread cellacdc/load.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

Comment thread cellacdc/acdc_regex.py
Comment on lines +43 to +44
if allowed is not None:
max_num_dots += sum([txt.count('.') for txt in allowed])
Comment thread cellacdc/acdc_regex.py
Comment on lines +46 to +48
for allowed_text in allowed:
allowed_text = re.escape(allowed_text)
pattern = pattern.replace(r'+$', fr'+({allowed_text})?$')
Comment thread cellacdc/acdc_regex.py
Comment on lines +26 to +30
def is_alphanumeric_filename(
text,
allow_space=True,
allowed: str | list[str] | None=None
):
Comment thread cellacdc/load.py
Comment on lines +3733 to 3738
if self.root is None:
return 'undefined'

Image = self.root.find(f'{self.ome_schema}Image')
Pixels = Image.find(f'{self.ome_schema}Pixels')
image = OMEXML_image(Pixels, self.ome_schema)
@ElpadoCan ElpadoCan merged commit d6183dd into main May 28, 2026
17 checks passed
@ElpadoCan ElpadoCan deleted the fix_datastruct_ome_tiff branch May 28, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants